﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassOdev
{
    class Program
    {
        static void Main(string[] args)
        {
            HotelObject1 obj1 = new HotelObject1();
            Console.WriteLine(obj1.ToString());

            Console.ReadLine();

        }
    }

    public class HotelObject
    {
        Dictionary<string, string> HotelProperty = new Dictionary<string, string>();

        public HotelObject()
        {
            Seed();
        }

        private void Seed()
        {
            HotelProperty.Add("Room 1", "Reserved");
            HotelProperty.Add("Room 2", "Free");
            HotelProperty.Add("Room 3", "Occupied");
            HotelProperty.Add("Room 4", "Reserved");
            HotelProperty.Add("Room 5", "Free");
            HotelProperty.Add("Room 6", "Free");
            HotelProperty.Add("Room 7", "Occupied");
            HotelProperty.Add("Room 8", "Occupied");
            HotelProperty.Add("Room 9", "Free");

        }

        public void AddHotelRoom(string roomName,string roomCondition)
        {
            if (!HotelProperty.ContainsKey(roomName))
            {
                HotelProperty.Add(roomName, roomCondition);
            }
            else
            {
                return;
            }
        }

        public void UpdateRoomStatus(string roomName,string roomCondition)
        {
            if (!HotelProperty.ContainsKey(roomName))
            {
                return;
            }
            else
            {
                HotelProperty[roomName] = roomCondition;
            }
        }

        public override string ToString()
        {
            string result = string.Empty;

            result = HotelProperty["Room 1"] + " " + HotelProperty["Room 2"] + " " + HotelProperty["Room 3"] + " " + HotelProperty["Room 4"] + " " + HotelProperty["Room 5"];

            return result;
        }
    }

    public class HotelObject1
    {
        public class HotelObjectStruct
        {
            public string HotelRoomName;
            public int HotelRoomCondition;
        }

        HotelObjectStruct[] HotelStructure;

        public HotelObject1()
        {
            HotelStructure = new HotelObjectStruct[10];
            Seed();
        }

        private void Seed()
        {
            HotelObjectStruct obj = new HotelObjectStruct();
            obj.HotelRoomName = "Room 1";
            obj.HotelRoomCondition = 0;
            HotelStructure[0] = obj;

            HotelObjectStruct obj1 = new HotelObjectStruct();
            obj1.HotelRoomName = "Room 2";
            obj1.HotelRoomCondition = -1;
            HotelStructure[1] = obj1;

            HotelObjectStruct obj2 = new HotelObjectStruct();
            obj2.HotelRoomName = "Room 3";
            obj2.HotelRoomCondition = 2;
            HotelStructure[2] = obj2;

            HotelObjectStruct obj3 = new HotelObjectStruct();
            obj3.HotelRoomName = "Room 4";
            obj3.HotelRoomCondition = 6;
            HotelStructure[3] = obj3;

            HotelObjectStruct obj4 = new HotelObjectStruct();
            obj4.HotelRoomName = "Room 5";
            obj4.HotelRoomCondition = 2;
            HotelStructure[4] = obj4;

            HotelObjectStruct obj5 = new HotelObjectStruct();
            obj5.HotelRoomName = "Room 6";
            obj5.HotelRoomCondition = 0;
            HotelStructure[5] = obj5;

            HotelObjectStruct obj6 = new HotelObjectStruct();
            obj6.HotelRoomName = "Room 7";
            obj6.HotelRoomCondition = 0;
            HotelStructure[6] = obj6;

            HotelObjectStruct obj7 = new HotelObjectStruct();
            obj7.HotelRoomName = "Room 8";
            obj7.HotelRoomCondition = -1;
            HotelStructure[7] = obj7;

            HotelObjectStruct obj8 = new HotelObjectStruct();
            obj8.HotelRoomName = "Room 9";
            obj8.HotelRoomCondition = 0;
            HotelStructure[8] = obj8;

        }

        public void AddHotelRoom(string roomName, int roomCondition)
        {
            if (!HotelStructure.Contains(new HotelObjectStruct { HotelRoomName=roomName,HotelRoomCondition=roomCondition}))
            {
                //add
            }
        }

        public void UpdateRoomStatus(string roomName, int roomCondition)
        {
            if (HotelStructure.Contains(new HotelObjectStruct { HotelRoomName = roomName, HotelRoomCondition = roomCondition }))
            {
                //update
            }
        }

        public override string ToString()
        {
            string result = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                result += HotelStructure[i].HotelRoomName + " ";
                if (HotelStructure[i].HotelRoomCondition<0)
                {
                    string a = HotelStructure[i].HotelRoomCondition.ToString();
                    a=a.Replace("-", "");
                    result += "Reserved for " + Convert.ToInt32(a) + "\n";
                }
                else if (HotelStructure[i].HotelRoomCondition ==0)
                {
                    result += "Free"+"\n";
                }
                else
                {
                    result += "Occupied for " + Convert.ToInt32(HotelStructure[i].HotelRoomCondition) + "\n";
                }
            }

            return result;
        }
    }
}
